<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="js/JS.js"></script>
    <script>
        JS.cargarModulos('js','UI,Form');


        $(document).ready(function(){
                $('#frm').ajaxForm({
                        url         : 'ajax/cargar-codigo.php',
                        type        : 'POST',
                        dataType    : 'json',
                        beforeSubmit: validate,
                        success     : hecho
                });
        $('#lnk').click(function(){
            
            $('#frm').submit();
        });

        });

        function hecho(data){
            console.debug(data);
        }



        function validate(formData, jqForm, options)
        {
            if ($("#txtCodigo").val().match(/^L(([0-2]\d\d)|3([0-5]\d|6[0-5]))\.I[1-7](A(1|2|5|6)){0,1}\.([0-1]\d|2[0-3])\:([0-5]\d)$/))
            {
                return true;
            }
            else
            {
                alert('código incorrecto');
                return false;
            }

        }

    </script>
  </head>
  <body>
      <form id="frm" name="frm">
          <input type="text" id="txtCodigo" name="txtCodigo"/>
          <a href="javascript:void(0);" id="lnk">cargar</a>
      </form>
  </body>
</html>
